package cn.xzqwjw.taskmanager.domain.pojo;

import cn.xzqwjw.taskmanager.common.validator.ValidGroupUpdate;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author rush
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class LogLogin extends Model<LogLogin> implements Serializable {

  @TableField(exist = false)
  private static final long serialVersionUID = 1L;

  @Override
  public Serializable pkVal() {
    return this.id;
  }

  /**
   * 主键id
   */
  @TableId(value = "id", type = IdType.AUTO)
  @NotNull(message = "id不能为空", groups = ValidGroupUpdate.class)
  private Integer id;

  /**
   * 登录的管理员id
   */
  @NotNull(message = "idAdmin 不能为空")
  private Integer idAdmin;

  /**
   * 登录时间
   */
  @NotNull(message = "登录时间不能为空")
  private LocalDateTime dtLogin;

  /**
   * 登录时的内网ip地址
   */
  @Length(max = 50, message = "最多 {max} 个字符")
  private String ipInner;

  /**
   * 登录时的外网ip地址
   */
  @Length(max = 50, message = "最多 {max} 个字符")
  private String ipOuter;

}
